<?php

/*
 * This file is part of the mivan project.
 *
 * (c) mivan project <http://github.com/mivan>
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use mivan\user\widgets\Connect;

/**
 * @var yii\web\View                   $this
 */
$this->context->layout = '@frontend/views/layouts/main-security';
$this->title = '用户登录';
$this->params['breadcrumbs'][] = $this->title;

?>

<div class="login-warp">
    <div class="login-bg" style="background-color: #f85316;">
        <div class="login-bg-w">
            <img src="/images/login_left_bg.png" class="left_bg" />
        </div>
    </div>

    <div class="login-w">
        <?php $form = ActiveForm::begin([
            'id'                     => 'login-form',
            'options'                => ['class' => 'form-horizontal'],
//            'enableAjaxValidation'   => true,
            'enableClientValidation' => false,
        ]) ?>

            <div class="form-group title">
                <h1>桌桌会员</h1>
                <?= Html::a('注册会员', ['/user/registration/register'], ['class'=> 'pull-right register']) ?>
            </div>
            <div class="alert alert-warning" role="alert">
                <i class="fa fa-warning"></i> 公共场所不建议自动登录，以防账号丢失
            </div>

            <?= $form->field($model, 'login', [
                'inputOptions' => ['placeholder' => '手机号码/邮箱/用户名', 'autofocus' => 'autofocus', 'class' => 'form-control', 'tabindex' => '1'],
                'template' => "<div class=\"input-group\">
                                <div class=\"input-group-addon\"><i class=\"fa fa-user\"></i></div>
                                    {input}
                               </div>
                               {error}"
            ])
            ?>

            <?= $form->field($model, 'password', [
                'inputOptions' => ['placeholder' => '密码', 'class' => 'form-control', 'tabindex' => '2'],
                'template' => "<div class=\"input-group\">
                                    <div class=\"input-group-addon\"><i class=\"fa fa-unlock-alt\"></i></div>
                                    {input}
                                </div>
                                {error}"
            ])->passwordInput()
            ?>

            <?= $form->field($model, 'rememberMe', [
                'inputOptions' => ['tabindex' => '4'],
                'template' => '<div class="checkbox">
                            {input}'.Html::a('忘记密码?', ['/user/registration/resend'], ['class' => 'pull-right']).'
                        </div>'
            ])->checkbox()
            ?>

            <div class="form-group">
                <?= Html::submitButton('登&nbsp;&nbsp;&nbsp;&nbsp;录', ['class' => 'btn btn-theme btn-block', 'tabindex' => '3']) ?>
            </div>
            <div class="form-group share-login">
                <div class="hz">
                    <span>使用合作网站账号登录桌桌</span>
                </div>
<!--                --><?//= Connect::widget([
//                    'baseAuthUrl' => ['/user/security/auth']
//                ]) ?>
                <ul class="list-inline">
                    <li><a href="#"><i class="fa-qq fa fa-2x"></i></a></li>
                    <li><a href="#"><i class="fa-wechat fa fa-2x"></i></a></li>
                    <li><a href="#"><i class="fa-weibo fa fa-2x"></i></a></li>
                    <li><a href="#"><i class="fa-tencent-weibo fa fa-2x"></i></a></li>
                    <li><a href="#"><i class="fa-cc-paypal fa fa-2x"></i></a></li>
                </ul>

            </div>
        <?php ActiveForm::end(); ?>

    </div>
</div>

<?php
$css = <<<CSS
.form-group {
    margin-bottom: 3px;
}
CSS;

$this->registerCss($css);
